extends Control


# Called when the node enters the scene tree for the first time.
func _ready():
	GlobalSignal.coinCollected.connect(updateCoinUI)
	GlobalSignal.playerHealthChanged.connect(updateHealth)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	pass
	

func setVisible(b):
	modulate.a = 1 if b else 0
	
	
func updateCoinUI():
	$Coin/Label.text = str(Global.coin) + ""
	

func updateHealth():
	$Health/Label.text = str(get_tree().get_first_node_in_group("Player").health)
